<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

</body>
</html>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script>
    //向后台请求json格式数据
    /*$(function () {
     var data = {
     roleName: '武松',
     note: 'note',
     pageParams: {
     start: 1,
     limit: 20
     }
     }

     $.post({
     url: 'params/findRoles.do',
     contentType: 'application/json',
     data: JSON.stringify(data),
     success: function (result) {
     //                alert(result.roleList[0].roleName);
     }
     });

     });*/

    //接受列表数据
    /*$(function () {
     //删除角色数组
     var idList = [1, 2, 3];

     $.post({
     url: 'params/deleteRoles.do',
     data: JSON.stringify(idList),
     contentType: 'application/json',
     success: function (result) {
     console.log(result);
     }
     });
     });*/

    //新增角色
    $(function () {
        var roleList = [
            {roleName: '张横', note: 'note1'},
            {roleName: '张顺', note: 'note2'},
            {roleName: '张飞', note: 'note3'}
        ];

        $.post({
            url: 'params/addRoles.do',
            data: JSON.stringify(roleList),
            contentType: 'application/json',
            success: function (result) {
                console.log(result);
            }
        });

    })


</script>